
	*****************************************************************
	* Taxing the Poor Twice: Bandwidth and the Value of Consumption * 
	*****************************************************************

	* PAPER FIGURES 
	

	* 1. Importing Merged Data 

	use "$dir_data/bandwidth_long_final.dta" , clear


	*** Main Paper Figures ***
	
	
	* setting scheme for figures 
	cd "${bandwidth}"
	set scheme eop
	
	
	
	

	* FIGURE 2  
	* two panel figure: density plot on the left, pooled treatment effect bar on the right 

	* Left Figure 
	* Kernel density for pooled experience score, pooled treatment vs control *
	
	tw kdensity exp_score_win if treated==0, bw(2.5) lp(dash) lc(black) ///
	|| kdensity exp_score_win if treated==1, bw(2.5) lp(solid) lc(orange_red) ylabel(,nogrid) ///
	legend(cols(1) position(4) ring(0) bplacement(east) size(large) lab(1 "Control") lab(2 "Treatment")) ///
	ytitle({bf:Density}) xtitle({bf:Score})		
			
	graph export "$dir_figures/figure2_densityplot.eps", replace
	graph export "$dir_figures/figure2_densityplot.pdf", replace


	* Right figure 
	* Pooled treatment 

	foreach y in food song video activity {
		eststo `y': xi: reg exp_score treated score_bs_favoritefood if exp_type == "`y'"
		}
	
	eststo pooled_act: xi: reg exp_score treated score_bs_favoritefood
	
	la var treated "Pooled Treat"
	
	coefplot (pooled_act, drop(score_bs_favoritefood _cons) color(orange_red%85) lcolor(black) ciopts(color(black) recast(rcap)) label("pooled")), ///
			 vertical recast(bar) drop(_cons) barwidth(.5) citop ///
			 yline(0, lwidth(medthick) lpattern(solid) lcolor(black)) format(%9.2f)  ylabel(, nogrid) ///
			 addplot(scatter @b @at, ms(i) mlabel(@b) mlabpos(4) mlabcolor(black)) ///
			 legend(off) xlabel(none) ytitle("{bf:Treatment Effect} (Points)") ///
			 ylabel(0.5(0.5)-1.5) yscale(range(0.5(0.5)-1.5)) ///
			 text(.24 0.99 "{bf:Pooled}", size(large)) ///		
			 text(-.474 1.103 "***", size(medium))
			 
			graph export "$dir_figures/figure2_bargraph.pdf", replace 
	
	
	
	
	
	
	
	* FIGURE 3  
	* two panel figure: disaggregated treatments on the left, disaggregated activities on the right 

	* Left figure 

	local controls "score_bs_favoritefood" 

		* Pooled treatments, pooled outcomes
		eststo pool_pool: xi: reg exp_score treated `controls', cl(pid)
			lincom _b[treated]
			local coef_pool_pool = string(r(estimate),"%3.2f")
			local se_pool_pool = string(r(se),"%3.2f")
			
		* Disaggregated treatment, pooled outcomes  
		eststo treat_pool: xi: reg exp_score i.treat `controls', cl(pid)
			lincom _b[_Itreat_1]
			local coef_prime_pool = string(r(estimate),"%3.2f")
			local se_prime_pool = string(r(se),"%3.2f")
			
			lincom _b[_Itreat_2]
			local coef_mem_pool = string(r(estimate),"%3.2f")
			local se_mem_pool = string(r(se),"%3.2f")
			
			lincom _b[_Itreat_3]
			local coef_thirst_pool = string(r(estimate),"%3.2f")
			local se_thirst_pool = string(r(se),"%3.2f")
	
		la var treated "Pooled Treat"
		
		foreach var in coef coef_ub coef_lb{
			cap drop `var'
			gen `var' = .
		}
		
		cap drop x
		gen x = _n

		local n = 0
		foreach i in pool mem prime thirst{
			local n = `n' + 1
			replace coef = `coef_`i'_pool' if x == `n'
			replace coef_ub = `coef_`i'_pool' + 1.96*`se_`i'_pool' if x == `n'
			replace coef_lb = `coef_`i'_pool' - 1.96*`se_`i'_pool' if x == `n'
		}
	
			twoway ///
				(bar coef x if x==3, color("bluishgray") lcolor(black)  barwidth(0.7)) ///
				(bar coef x if x==2, color("emerald") lcolor(black)  barwidth(0.7)) ///
				(bar coef x if x==4, color("dknavy") lcolor(black)  barwidth(0.7)) ///
				(rcap coef_ub coef_lb x if x==4 | x==3 | x==2, lcolor(black) lwidth(medthin)), ///
				text(.24 2 "{bf:Memory}", place(c) size(large) color("15 15 15")) ///
				text(.24 3 "{bf:Fin. Stress}", place(c) size(large) color("15 15 15")) ///
				text(.24 4 "{bf:Thirst}", place(c) size(large) color("15 15 15")) ///			
				text(-.605 2.05 "-0.56***", place(e) size(medium) color("15 15 15")) ///
				text(-.38 3.06 "-0.33**", place(e) size(medium) color("15 15 15")) ///
				text(-.468 4.05 "-0.42**", place(e) size(medium) color("15 15 15")) ///
				xtitle("", height(3)) ytitle("{bf:Treatment Effect} (points)", height(.5)) ///
				yscale(r(-1.5(0.5)0.5)) ylabel(-1.5(0.5)0.5) xscale(r(1(0.5)5)) xlabel(none)  ///
				yline(0, lwidth(medthick) lpattern(solid) lcolor(black)) ylabel(, nogrid) ///
				legend(off) graphregion(fcolor(white)) aspectratio(0.7)
				
				graph export "$dir_figures/figure3_treatments.eps", replace
			
			
	* Right figure 
			

	foreach y in food song video activity {
		eststo `y': xi: reg exp_score treated score_bs_favoritefood if exp_type == "`y'" 
		}
	
	eststo pooled_act: xi: reg exp_score treated score_bs_favoritefood 

		 
	coefplot (food, drop(score_bs_favoritefood _cons) color("dkorange") lcolor(black) ciopts(color(black) recast(rcap))) ///
			 (song, drop(score_bs_favoritefood _cons) color("sand") lcolor(black) ciopts(color(black) recast(rcap))) ///
			 (video, drop(score_bs_favoritefood _cons) color("200 0 0") lcolor(black) ciopts(color(black) recast(rcap))) ///
			 (activity, drop(score_bs_favoritefood _cons) color("gold") lcolor(black) ciopts(color(black) recast(rcap))), ///
			 vertical recast(bar) drop(_cons) barwidth(.15) citop ///
			 addplot(scatter @b @at, ms(i) mlabel(@b) mlabpos(4) mlabcolor(black)) ///
			 yline(0, lwidth(medthick) lpattern(solid) lcolor(black)) format(%9.2f) ylabel(, nogrid) ///
			 legend(off) xlabel(none) yscale(r(-1.5(0.5)0.5))ytitle("{bf:Treatment Effect} (Points)") ///
			 text(.25 .69 "{bf:Food}", size(large)) ///
			 text(.25 0.9 "{bf:Song}", size(large)) ///
			 text(.25 1.10 "{bf:Video}", size(large)) ///
			 text(.25 1.30 "{bf:Games}", size(large)) ///		
			 text(-.821 .8 "***" -.39 0.996 "**" -.342 1.187 "*") 
			
			 graph export "$dir_figures/figure3_activities.pdf", replace 
	
	
	
	
	
	
	
	
	* FIGURE 4 Heterogeneous Treatment Effect by Socio-economic Status 

	reg exp_score treated if (treat == 0 | treat == 1) & wealth_index_median==1, cl(pid)
	lincom _b[treated]
	local coef_m1 = string(r(estimate),"%3.2f")
	local se_m1 = string(r(se),"%3.2f")
			
	reg exp_score treated if (treat == 0 | treat == 1) & wealth_index_median==2, cl(pid)
	lincom _b[treated]
	local coef_m2 = string(r(estimate),"%3.2f")
	local se_m2 = string(r(se),"%3.2f")

	foreach var in coef coef_ub coef_lb{
			cap drop `var'
			gen `var' = .
		}
		
		cap drop x
		gen x = _n

		local n = 0
		foreach i in m1 m2 {
			local n = `n' + 1
			replace coef = `coef_`i'' if x == `n'
			replace coef_ub = `coef_`i'' + 1.96*`se_`i'' if x == `n'
			replace coef_lb = `coef_`i'' - 1.96*`se_`i'' if x == `n'
		}

		
		twoway ///
				(bar coef x if x==1, color("bluishgray") lcolor(black)  barwidth(0.8)) ///
				(bar coef x if x==2, color("bluishgray") lcolor(black)  barwidth(0.8)) ///
				(rcap coef_ub coef_lb x if x==1 | x==2, lcolor(black) lwidth(medthin)), ///
				text(1 1 "{bf:Below Median}", place(c) size(medium) color("15 15 15")) ///
				text(1 2 "{bf:Above Median}", place(c) size(medium) color("15 15 15")) ///			
				text(-0.78 1 "{bf: -0.72***}", place(e) size(medium) color("15 15 15")) ///
				text(0.1 2 "{bf: 0.003}", place(e) size(medium) color("15 15 15")) ///
				xtitle("Participant Socioeconomic Status", height(6) size(medlarge)) ytitle("Treatment Effect (points)", height(.5) size(medlarge)) ///
				yscale(r(-1 0.3)) ylabel(-1.2(0.2)1.2) xlabel(none)  ///
				yline(0, lwidth(medthick) lpattern(solid) lcolor(black)) ylabel(, nogrid) ///
				legend(off) graphregion(fcolor(white)) aspectratio(0.8) 
 				graph export "$dir_figures/figure4_hte_by_SES.pdf", replace
	
	
	
	
	
	
	*** Appendix Figures ***
		 
		 
		 
		 

	* FIGURE S2 Treated Individuals Anchor on Market Prices 

	twoway (histogram wtp_value if treat == 0 & wtp_type == "food" & choice_food_bdm == 2, ///
			color(white%100) lcolor(black%100) lwidth(medthick) discrete percent gap(50) xlabel(0[2]16, nogrid) ///
			xline(6, lcolor(189 30 36) lp(dash))) ///
			(histogram wtp_value if treat == 1 & wtp_type == "food" & choice_food_bdm == 2, ///
			color(orange_red%75) lcolor(black%100) lwidth(medthick) discrete percent gap(50) ///
			xline(10, lcolor(189 30 36) lp(dash)) xla(10 "modal price") xlabel(0[2]16, nogrid) ///
			yscale(r(0(5)40)) ylabel(0(10)40) ///
			lcolor(black) xtitle("{bf:Willingness to Pay}")), yscale(r(0(5)40)) ylabel(,nogrid) ///
			legend(order(1 "Control" 2 "Treated") size(medlarge) pos(6) col(2) row(1)) ///
			text(40 5.95 "{bf:Control}", size(med)) ///
			text(38 5.95 "{bf:Mode}", size(med)) ///
			text(40 9.9 "{bf:Survey and}", size(med)) ///
			text(38 9.9 "{bf:Treatment}", size(med)) ///
			text(36 9.9 "{bf:Mode}", size(med)) 
			
		graph export "$dir_figures/figureS2_anchoring.eps", replace
		graph export "$dir_figures/figureS2_anchoring.pdf", replace
		
		
		
		
		
		
		
	* FIGURE S3 Lower Ex-ante WTP for Enjoyable Activity While Bandwidth Constrained *

	tw kdensity wtp_sequential, bw(4) lp(dash) lc(black) ///
	|| kdensity wtp_simultaneous, bw(4) lp(solid) lc(orange_red) ylabel(,nogrid) ///
	legend(cols(1) position(4) ring(0) bplacement(1) lab(1 "{bf:Sequential}") lab(2 "{bf:Simultaneous (Treated)}")) ///
	ytitle(Density) xtitle(Score)					
				
	graph export "$dir_figures/figureS3_exante_WTP.eps", replace
	graph export "$dir_figures/figureS3_exante_WTP.pdf", replace
	
	
		
